const config = require('./config.js')
module.exports = function (path, data, method) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: config.baseUrl + path,
      method: method,
      data: data,
      success: res => {
        resolve(res.data)
      },
      // 请求成功
      fail: function () {
        // 请求失败
        reject()    
      }
    })
  })
}